package zencstudio.sgrealtor.view.common;

import zencstudio.sgrealtor.utils.ISlideMenuNofifier;
import zencstudio.sgrealtor.view.phone.SearchActivity;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageButton;
import android.widget.RelativeLayout;

import zencstudio.sgrealtor.R;

public class TopMenuBar extends RelativeLayout{

	private ImageButton btnNavigate;
	private ImageButton btnSearch;
	public TopMenuBar(Context context) {
		super(context);
	}
	public TopMenuBar(Context context, AttributeSet attrs){
		super(context, attrs);
	}
	public TopMenuBar(Context context, AttributeSet attrs, int defStyle){
		super(context,attrs,defStyle);
	}
	public void initUI(){
		btnNavigate = (ImageButton) findViewById(R.id.btnNavigate);
		btnSearch = (ImageButton) findViewById(R.id.btnSearch);
		
	    
		setControls();
	}
	public void updateUI(){
		
	}
	private void setControls(){
		btnNavigate.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				/*Intent intent = new Intent(getContext(),ChartActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP|Intent.FLAG_ACTIVITY_CLEAR_TOP);
				getContext().startActivity(intent);*/
				Context context = getContext();
				if(context instanceof ISlideMenuNofifier)
					((ISlideMenuNofifier)context).showSlideMenu();
			}
		});
		btnSearch.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(getContext(),SearchActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP|Intent.FLAG_ACTIVITY_CLEAR_TOP);
				getContext().startActivity(intent);
			}
		});
	}
}
